package com.android.model.entity.res;

import android.util.Log;

import java.math.BigDecimal;

/**
 * created by TenFace at 2017/6/2
 */
public class QuoteStockInfoSnapData {

    /**
     * data : {"bp1":141.96,"bv1":1,"change":0.5,"code":"QQQ","dealtime":"16:00:02","high":141.9,"low":140.9899,"name":"纳斯达克100指数","open":141.58,"percent":0.0035,"prev":141.29,"price":141.79,"sp1":142.03,"sv1":2,"volume":2.0101332E7}
     * status : C_200
     */

    private DataBean data;
    private String status;

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public static class DataBean {
        private static final String TAG = "QuoteStockInfoSnapData.DataBean";
        /**
         * bp1 : 141.96
         * bv1 : 1.0
         * change : 0.5
         * code : QQQ
         * dealtime : 16:00:02
         * high : 141.9
         * low : 140.9899
         * name : 纳斯达克100指数
         * open : 141.58
         * percent : 0.0035
         * prev : 141.29 // 昨日收盘价
         * price : 141.79
         * sp1 : 142.03
         * sv1 : 2.0
         * volume : 2.0101332E7
         */

        private double bp1;
        private double bv1;
        private double change;
        private String code;
        private String dealtime;
        private double high;
        private double low;
        private String name;
        private double open;
        private double percent;
        private double prev;
        private BigDecimal price;
        private double sp1;
        private double sv1;
        private double volume;
        private double close;//删掉，没用（与last不同）

        private BigDecimal amount;//总成交额
        private BigDecimal currentVolume;//当前分钟的成交量

        /**
         * 获取 当前成交价
         *
         * @return 当前成交价
         */
        public BigDecimal getCurrentAvg() {
            if (amount == null) {
                Log.e(TAG, "当前还没有成交额");
                return BigDecimal.ZERO;
            }
            if (volume == 0) {
                Log.e(TAG, "当前还没有成交量");
                return BigDecimal.ZERO;
            }
            return amount.divide(new BigDecimal(Double.toString(volume)), BigDecimal.ROUND_DOWN);
        }

        public double getBp1() {
            return bp1;
        }

        public void setBp1(double bp1) {
            this.bp1 = bp1;
        }

        public double getBv1() {
            return bv1;
        }

        public void setBv1(double bv1) {
            this.bv1 = bv1;
        }

        public double getChange() {
            return change;
        }

        public void setChange(double change) {
            this.change = change;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDealtime() {
            return dealtime;
        }

        public void setDealtime(String dealtime) {
            this.dealtime = dealtime;
        }

        public double getHigh() {
            return high;
        }

        public void setHigh(double high) {
            this.high = high;
        }

        public double getLow() {
            return low;
        }

        public void setLow(double low) {
            this.low = low;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public double getOpen() {
            return open;
        }

        public void setOpen(double open) {
            this.open = open;
        }

        public double getPercent() {
            return percent;
        }

        public void setPercent(double percent) {
            this.percent = percent;
        }

        public double getPrev() {
            return prev;
        }

        public void setPrev(double prev) {
            this.prev = prev;
        }

        public double getPrice() {
            return price.doubleValue();
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }

        public double getSp1() {
            return sp1;
        }

        public void setSp1(double sp1) {
            this.sp1 = sp1;
        }

        public double getSv1() {
            return sv1;
        }

        public void setSv1(double sv1) {
            this.sv1 = sv1;
        }

        public double getVolume() {
            return volume;
        }

        public void setVolume(double volume) {
            this.volume = volume;
        }

        public double getClose() {
            return close;
        }

        public void setClose(double close) {
            this.close = close;
        }

        public BigDecimal getAmount() {
            return amount;
        }

        public void setAmount(BigDecimal amount) {
            this.amount = amount;
        }

        public BigDecimal getCurrentVolume() {
            return currentVolume;
        }

        public void setCurrentVolume(BigDecimal currentVolume) {
            this.currentVolume = currentVolume;
        }

        @Override
        public String toString() {
            return "DataBean{" +
                    "bp1=" + bp1 +
                    ", bv1=" + bv1 +
                    ", change=" + change +
                    ", code='" + code + '\'' +
                    ", dealtime='" + dealtime + '\'' +
                    ", high=" + high +
                    ", low=" + low +
                    ", name='" + name + '\'' +
                    ", open=" + open +
                    ", percent=" + percent +
                    ", prev=" + prev +
                    ", price=" + price +
                    ", sp1=" + sp1 +
                    ", sv1=" + sv1 +
                    ", volume=" + volume +
                    ", close=" + close +
                    ", amount=" + amount +
                    '}';
        }
    }
}
